package com.duguo.dynamicmvc.demo.accounts.model;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.duguo.dynamicmvc.demo.accounts.domain.User;

public class LoggedinUserResolver {
	
	public static final String LOGGEDIN_USER="loggedinUser";

	public User resolve(HttpServletRequest request){
		HttpSession session = request.getSession(false);
		if(session!=null){
			return (User)session.getAttribute(LOGGEDIN_USER);
		}else{
			return null;
		}
	}
}
